package com.insta.java.util;

import java.util.ArrayList;
import java.util.List;

import com.insta.java.dto.LocationDto;
import com.insta.java.model.Location;

public class LocationConvert {

	public LocationConvert(){};
	
	public static LocationDto convert(Location location){
		return new LocationDto(location.getId(), location.getRenter().getLogin(), location.getDateLocation().toString(), location.getDateReturn().toString(), location.getBookISBN());
	}
	
	public static List<LocationDto> convertFromListLocationToListDTO(List<Location> locations){
		List<LocationDto> list= new ArrayList<LocationDto>();
		for(Location location: locations){
			list.add(convert(location));
		}
		return list;
	}
}
